<template>
  <dialog class="dialog-outer" ref="favDialog">
    <div style="margin-bottom: 4px">
      <Input v-model="curName" />
    </div>
    <div style="height: 48px; line-height: 48px">
      <button @click="okHandler" class="ivu-btn ivu-btn-primary" style="margin-right: 4px">确定</button>
      <button @click="cancelHandler" class="ivu-btn" style="margin-right: 4px">取消</button>
    </div>
  </dialog>
</template>

<script>
export default {
  name: 'GetNameDialog',
  data() {
    return {
      curName: null,

      dialogShow: false,

      schemaStr: null,
      curNode: {},

      curResolve: null,
      curReject: null,
    };
  },
  methods: {
    openDialog(param) {
      this.curName = param || '新建文件夹';
      this.$refs.favDialog.showModal();
      return new Promise((resolve, reject) => {
        this.curResolve = resolve;
        this.curReject = reject;
      });
    },
    okHandler() {
      if (!this.curName) {
        this.$Message.warning('请输入文本');
        return;
      }
      this.$refs.favDialog.close();
      this.curResolve(this.curName);
    },
    cancelHandler() {
      this.$refs.favDialog.close();
    },
  },
  mounted() {
    // this.$refs.favDialog.showModal();
  },
};
</script>

<style scoped>
.dialog-outer {
  padding: 8px;
  border: none;
  border-radius: 4px;
  width: 200px;
  height: 100px;
  /* box-shadow: 0px 1px 4px 0px rgba(227, 232, 238, 1); */
}
</style>
